home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / vcon.s < prev   
Encoding:
Text File  |  1993-10-04  |  7.0 KB  |  199 lines

  1. #! /bin/csh
  2. #  vcon is a csh script to provide text level version control using ISTVC.
  3. #
  4. #
  5. #  Invocation:
  6. #
  7. #  vcon <option> version_file source_file
  8. #
  9. #  where option is one of
  10. #
  11. #    -u: Update (create) version_file using source_file as the
  12. #        next (first) version.  User is invited to make comments.
  13. #
  14. #    -n: Same as -u except that user is not invited to make comments.
  15. #
  16. #    -e: If version_file exists, edit the most recent version and
  17. #        update using the edited file as the next version.  If
  18. #        version_file does not exist, invoke the editor to create
  19. #        Version 1.
  20. #
  21. #    -r: version_file is assumed to exist and is reinitialized
  22. #        with the latest version as Version 1.
  23. #
  24. #    -v[n]: Output version n to standard output.  If n is missing,
  25. #        output the latest version.
  26. #
  27. #    -tY/M/D/H/m/S: Output version current as of year Y, month M,
  28. #        day D, hour H, minute m, second S.  Least significant
  29. #        units are 0 if omitted.
  30. #
  31. #    -d[n]: Output differences between version n-1 and version n.
  32. #        If n is missing, output all differences.
  33. #
  34. #    -c[n]: Output time created and comments appended when creating
  35. #        version n.  If n is missing, output all comments.
  36. #
  37. #  Note: source_file is required only with options -u and -n.
  38. #
  39. #  Check command line validity.
  40. if ( $#argv < 2 ) then
  41. TOOLPACKPATH/toolpack1.2/util/echoerr \
  42. Invocation:
  43. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  44. TOOLPACKPATH/toolpack1.2/util/echoerr \
  45. "vcon <option> version_file source_file"
  46. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  47. TOOLPACKPATH/toolpack1.2/util/echoerr \
  48. where option is one of
  49. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  50. TOOLPACKPATH/toolpack1.2/util/echoerr \
  51. "  -u: Update (create) version_file using source_file as the"
  52. TOOLPACKPATH/toolpack1.2/util/echoerr \
  53. "      next (first) version.  User is invited to make comments."
  54. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  55. TOOLPACKPATH/toolpack1.2/util/echoerr \
  56. "  -n: Same as -u except that user is not invited to make comments."
  57. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  58. TOOLPACKPATH/toolpack1.2/util/echoerr \
  59. "  -e: If version_file exists, edit the most recent version and"
  60. TOOLPACKPATH/toolpack1.2/util/echoerr \
  61. "      update using the edited file as the next version.  If"
  62. TOOLPACKPATH/toolpack1.2/util/echoerr \
  63. "      version_file does not exist, invoke the editor to create"
  64. TOOLPACKPATH/toolpack1.2/util/echoerr \
  65. "      Version 1."
  66. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  67. TOOLPACKPATH/toolpack1.2/util/echoerr \
  68. "  -r: version_file is assumed to exist and is reinitialized"
  69. TOOLPACKPATH/toolpack1.2/util/echoerr \
  70. "      with the latest version as Version 1."
  71. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  72. TOOLPACKPATH/toolpack1.2/util/echoerr \
  73. "  -v[n]: Output version n to standard output.  If n is missing,"
  74. TOOLPACKPATH/toolpack1.2/util/echoerr \
  75. "      output the latest version."
  76. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  77. TOOLPACKPATH/toolpack1.2/util/echoerr \
  78. "  -tY/M/D/H/m/S: Output version current as of year Y, month M,"
  79. TOOLPACKPATH/toolpack1.2/util/echoerr \
  80. "      day D, hour H, minute m, second S.  Least significant"
  81. TOOLPACKPATH/toolpack1.2/util/echoerr \
  82. "      units are 0 if omitted."
  83. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  84. TOOLPACKPATH/toolpack1.2/util/echoerr \
  85. "  -d[n]: Output differences between version n-1 and version n."
  86. TOOLPACKPATH/toolpack1.2/util/echoerr \
  87. "      If n is missing, output all differences."
  88. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  89. TOOLPACKPATH/toolpack1.2/util/echoerr \
  90. "  -c[n]: Output time created and comments appended when creating"
  91. TOOLPACKPATH/toolpack1.2/util/echoerr \
  92. "      version n.  If n is missing, output all comments."
  93. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  94. TOOLPACKPATH/toolpack1.2/util/echoerr \
  95. "Note: source_file is required only with options -u and -n."
  96. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  97.    exit
  98. endif
  99. #  vcopt contains <option>.
  100. set vcopt = $1
  101. #  key contains u, n, e, r, v, t, d, or c depending on option.
  102. set key = `TOOLPACKPATH/toolpack1.2/util/char2 $vcopt`
  103. #  vcvers contains the name of the version file.
  104. set vcvers = $2
  105. #  srcdest contains the name of either the source or destination file.  The
  106. #  name may be null if neither file is used for the requested option.
  107. #  tmpsrc contains the name of a scratch file.
  108. set srcdest = $3
  109. set tmpsrc = src$$
  110. #
  111. #  Create PFS.  If PFS already exists, exit with an advisory message.
  112. #
  113. if ( -e _.TOOLPACK == 0 ) then
  114.    mkdir _.TOOLPACK
  115. else
  116. TOOLPACKPATH/toolpack1.2/util/echoerr \
  117. Toolpack-created directory '"_.TOOLPACK"' exists. \
  118. Remove with script '"discard"'.
  119.    exit
  120. endif
  121. echo > _.TOOLPACK/$tmpsrc
  122. #  pfsflag will be reset to true when the source/destination file is
  123. #  in the PFS or is standard output.
  124. set pfsflag = false
  125. if ( $key == "e" ) then
  126. #  If $vcvers exists, invoke ISTVC with option v to produce latest version
  127. #  as $tmpsrc .  Edit $tmpsrc to produce a source file for updating or
  128. #  creating $vcvers .
  129.    if ( -e $vcvers == 1 ) then
  130. TOOLPACKPATH/toolpack1.2/util/mkipf \
  131. -v \#$vcvers $tmpsrc
  132. TOOLPACKPATH/toolpack1.2/exec/istvc.u
  133.    endif
  134. #  Edit $tmpsrc and make edited version a source file.
  135.    onintr -
  136.    vi _.TOOLPACK/$tmpsrc
  137.    onintr
  138.    set srcdest = $tmpsrc
  139. #  The later updating process must be informed that the temporary file
  140. #  is in the PFS.
  141.    set pfsflag = true
  142. #  Reset vcopt for updating.
  143.    set vcopt = "-u"
  144. else if ( $key == "r" ) then
  145. #  Reinitialize $vcvers with the latest version as Version 1.
  146.    if ( -e $vcvers == 0 ) then
  147. TOOLPACKPATH/toolpack1.2/util/echoerr \
  148. Version file must exist.  To create a version file,
  149. TOOLPACKPATH/toolpack1.2/util/echoerr \
  150. use option "-e" or option "-u".
  151.       exit
  152.    endif
  153. TOOLPACKPATH/toolpack1.2/util/mkipf \
  154. -v \#$vcvers $tmpsrc
  155. TOOLPACKPATH/toolpack1.2/exec/istvc.u
  156.    /bin/rm $vcvers
  157.    set srcdest = $tmpsrc
  158.    set pfsflag = true
  159.    set vcopt = "-u"
  160. else if ( $key == "v" || $key == "t" ) then
  161. #  Set destination file to standard output.
  162.    set srcdest = \#1
  163.    set pfsflag = true
  164. endif
  165. #  Create the interprocess file IST.CMD and append parameters for ISTVC.
  166. if ( $pfsflag == true ) then
  167. TOOLPACKPATH/toolpack1.2/util/mkipf \
  168. $vcopt \#$vcvers $srcdest
  169. else
  170. TOOLPACKPATH/toolpack1.2/util/mkipf \
  171. $vcopt \#$vcvers \#$srcdest
  172. endif
  173. #
  174. #  Invoke ISTVC.
  175. #
  176. TOOLPACKPATH/toolpack1.2/exec/istvc.u
  177. #
  178. #  Remove the scratch file unless the changes are too complicated to create
  179. #  a new version.  In this case, ISTVC will terminate with a status of ERROR
  180. #  in _.info .  If the attempt at a complicated update occurs using option e,
  181. #  copy the edited source to a working directory file called _.SAVEDFILE .
  182. #  If the attempt at a complicated update occurs using options u or n,
  183. #  then the source file exists and it is only necessary to inform
  184. #  the user of the action taken.
  185. #
  186. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  187.    if ( $key == "e" ) then
  188.       cp _.TOOLPACK/$tmpsrc _.SAVEDFILE
  189. TOOLPACKPATH/toolpack1.2/util/echoerr \
  190. 'Edited source saved in "_.SAVEDFILE".'
  191.    else if ( $key == "u" || $key == "n" ) then
  192. TOOLPACKPATH/toolpack1.2/util/echoerr \
  193. "'$vcvers' not updated."
  194.    endif
  195. endif
  196. #
  197. /bin/rm -r _.TOOLPACK
  198. #
  199.